<?php
$this->breadcrumbs=array(
    'Districts'=>array('list'),
);

$this->menu=array(
    array('label'=>'Create District','url'=>array('create')),
    //array('label'=>'Manage District','url'=>array('admin')),
);
?>

<h1>Districts</h1>

<?php //dropdown nationality
    echo CHtml::beginForm('list', 'get', array('id' => 'provinceDistrict'));
    
    echo CHtml::label('Country', 'nationalityId');
    echo CHtml::dropDownList('nationalityId', 
        $_GET['nationalityId'], 
        CHtml::listData(Nationality::model()->getAllActive(), 'id', 'country'),
        array(
            'ajax' => array(
                'type'=>'POST',
                'url'=>CController::createUrl(Yii::app()->language . '/province/getOptionByNationalityId'),
                'update'=>'#provinceId',
            )
        )
    );

    echo CHtml::label('Province', 'provinceId');
    echo CHtml::dropDownList('provinceId',
            $_GET['provinceId'],
            CHtml::listData(Province::model()->getByNationalityId($_GET['nationalityId']), 'id', 'name'),
            array(
                'id' => 'provinceId',
            )
    );
  echo CHtml::endForm();
?>

<?php $this->widget('bootstrap.widgets.TbGridView',array(
    'dataProvider'=>$dataProvider,
    'columns'=>array(
        array('name'=>'id', 'header'=>'#'),
        array('name'=>'name_en'),
        array('name'=>'name_th'),
        array('name'=>'activeFlag', 'header'=>'Active'),
        array(
            'class'=>'bootstrap.widgets.TbButtonColumn',
            'htmlOptions'=>array('style'=>'width: 50px'),
        ),
    ),
)); ?>
